package Bebetter.Day03;

import java.util.Scanner;

/**
 * @Author:galaxy_yan
 * @Date: 2022/11/24
 * @Time: 21:13
 * @Description 进制转换
 */
public class B2 {
    public static void main(String[] args) {
        char[] arr={'1','2','3','4','5','6','7','8','9','a','b','c','d','e','f'};
        Scanner sc=new Scanner(System.in);
//        十进制数
        int M=sc.nextInt();
//        进制数
        int N= sc.nextInt();

        while (M/N>0){
            System.out.println(arr[M%N-1]);
        }
    }
}
